package com.zaofan.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.zaofan.bean.Reply;
import com.zaofan.dao.ReplyDao;

public class ReplyService {
	private ReplyDao replyDao = new ReplyDao();

	public void delete(Reply reply) {
		replyDao.del(reply);
	}

	public void add(Reply reply) {
		replyDao.add(reply);
	}

	public void update(Reply reply) {
		replyDao.update(reply);
	}

	public List<Reply> findAll(Map<String, Object> params) {
		List<Reply> data = replyDao.findAll(params);
		if (data == null) {
			data = new ArrayList<>();
		}
		return data;
	}

	public Long count(Map<String, Object> params) {
		return replyDao.count(params);
	}

	public Reply findById(Integer id) {
		Map<String, Object> params = new HashMap<>();
		params.put("id", id);
		return replyDao.findOne(params);
	}

	public Reply findByCommentId(int commentId) {
		Map<String, Object> params = new HashMap<>();
		params.put("commentId", commentId);
		return replyDao.findOne(params);
	}

}